package giftmail.mq;

import javax.jms.JMSException;
import javax.jms.Message;
import javax.jms.Session;

import org.springframework.jms.support.converter.MessageConversionException;

public interface MessageConverter {

	/**
	 * 用来把一个Java对象转换成对应的JMS Message
	 * @param object
	 * @param session
	 * @return
	 * @throws JMSException
	 * @throws MessageConversionException
	 */
	Message toMessage(Object object, Session session) throws JMSException, MessageConversionException;

	/**
	 * 用来把一个JMS Message转换成对应的Java对象
	 * @param message
	 * @return
	 * @throws JMSException
	 * @throws MessageConversionException
	 */
	Object fromMessage(Message message) throws JMSException, MessageConversionException;
}
